package com.itheima.service.impl;

import com.itheima.service.AccountService;
import com.itheima.service.AccountServiceClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * TODO: propagation事务的传播行为
 *      1.注意：事务管理员和事务协调员要在不同的bean中
 *      2.
 */
@Service
public class AccountService4Impl implements AccountService {

    @Autowired
    AccountServiceClass accountServiceClass;

    @Override
    public void transfer(int outId, int inId, double money) {
        try {
            //转账操作
            accountServiceClass.s1(outId, inId, money);
        } finally {
            //记录日志
            accountServiceClass.s2(outId, inId, money);
        }
    }

}
